/*
 * @Author: zwf 240970521@qq.com
 * @Date: 2023-07-20 19:40:26
 * @LastEditors: zwf 240970521@qq.com
 * @LastEditTime: 2023-08-09 23:25:05
 * @FilePath: /esp32_motor/motor/inc/currentSensing.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef CURRENT_SENSING_H
#define CURRENT_SENSING_H

#include "esp_adc/adc_continuous.h"
#include "IQmathLib.h"

typedef struct CurrentSensing
{
    void *priv;
    esp_err_t (*readAll)(struct CurrentSensing *);
    _iq24 (*getIa)(struct CurrentSensing *);
    _iq24 (*getIb)(struct CurrentSensing *);
    _iq24 (*getIc)(struct CurrentSensing *);
    void (*correctAmpere)(struct CurrentSensing *);
} CurrentSensing;

void      CURRENT_delete(CurrentSensing *dev);
esp_err_t CURRENT_create(CurrentSensing **dev, int pinA, int pinB, int voltageGain, int offsetVoltage, float ohm);

#endif
